<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>注册</title>
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<script type="application/x-javascript">
			addEventListener("load", function() {
				setTimeout(hideURLbar, 0);
			}, false);

			function hideURLbar() {
				window.scrollTo(0, 1);
			}
		</script>
		<meta name="keywords" content="Flat Dark Web Login Form Responsive Templates, Iphone Widget Template, Smartphone login forms,Login form, Widget Template, Responsive Templates, a Ipad 404 Templates, Flat Responsive Templates" />
		<link href="style.css" tppabs="https://demo.mycodes.net/houtai/klasikal/css/style.css" rel='stylesheet' type='text/css' />
		<!--webfonts-->
		<link href="css-family=PT+Sans-400,700,400italic,700italic-Oswald-400,300,700.css" tppabs="http://fonts.useso.com/css?family=PT+Sans:400,700,400italic,700italic|Oswald:400,300,700" rel='stylesheet' type='text/css'>
		<link href="css-family=Exo+2.css" tppabs="http://fonts.useso.com/css?family=Exo+2" rel='stylesheet' type='text/css'>
		<!--//webfonts-->
	</head>

	<body>
		<script>
			$(document).ready(function(c) {
				$('.close').on('click', function(c) {
					$('.login-form').fadeOut('slow', function(c) {
						$('.login-form').remove();
					});
				});
			});
		</script>
		<!--SIGN UP-->
		<h1>潮漫酒店用户注册</h1>
		<div class="login-form">
			<div class="close"> </div>
			<div class="head-info">
				<label class="lbl-1"> </label>
				<label class="lbl-2"> </label>
				<label class="lbl-3"> </label>
			</div>
			<div class="clear"> </div>
			<div class="avtar">
				<img src="avtar.png" tppabs="https://demo.mycodes.net/houtai/klasikal/images/avtar.png" />
			</div>
			<form>
				<input type="text" id="username" class="text" value="" placeholder="请输入用户名">
				<input type="text" id="password" class="text" value="" placeholder="请输入密码">
				<input type="text" id="loginname" class="text" value="" placeholder="请输入身份证号">
			</form>
			<div class="signin">
				<input type="submit" onclick="add()" value="注册">
			</div>
		</div>

	</body>
	<script>
		function add() {

			var username = $("#username").val()
			var password = $("#password").val()
			var loginname = $("#loginname").val()

			if(username == null || username == "") {
				alert("请输入用户名")
				reutrn
			}
			if(password == null || password == "") {
				alert("请输入密码")
				return
			}
			if(loginname == null || loginname == "") {
				alert("请输入身份证号")
				return
			}

			$.ajax({
				type: "get",
				url: "http://localhost:8080/add",
				data: {
					username: username,
					password: password,
					loginname: loginname
				},
				success: function(result) {
					console.log(result)
					if(result == "1") {
						alert("恭喜注册成功")
						window.location = "login.html"
					} else {
						alert("注册失败")
					}
				}

			});
		}
	</script>
	<script src="jquery-1.11.1.min.js"></script>

</html>